package com.pai4j.pgc.service.message.builder;

import com.pai4j.common.constants.MessageConstants;
import com.pai4j.common.enums.community.ResourceTypeEnum;
import com.pai4j.domain.vo.dto.CommentReplyMessageDTO;

import java.util.Date;

/**
 *
 *
 * @author: CYM-pai
 * @date: 2025/10/28 21:25
 **/
public class CommentReplyMessageBuilder extends AbstractMessageBuilder {

    @Override
    protected String getMessageCategory() {
        return MessageConstants.CategoryEnum.COMMENT_REPLY.getCategory();
    }

    /**
     * 构建评论回复消息
     * @param type 评论或回复通过type区分
     * @param fromUserId
     * @param toUserId
     * @param resourceType 内容主体
     * @param resourceId 内容id
     * @param content 评论或回复消息
     * @return
     */
    public CommentReplyMessageDTO build(MessageConstants.TypeEnum type,
                                        String fromUserId,
                                        String toUserId,
                                        ResourceTypeEnum resourceType,
                                        String resourceId,
                                        String content) {
        CommentReplyMessageDTO message = new CommentReplyMessageDTO();
        message.setCategory(getMessageCategory());
        message.setType(type.getType());
        message.setFromUserId(fromUserId);
        message.setToUserId(toUserId);
        message.setResourceType(resourceType.getType());
        message.setResourceId(resourceId);
        message.setContent(content);
        message.setCreateDate(new Date());
        return message;
    }
}
